<template>
  <div 
    v-if="notification" 
    class="notification" 
    :class="{'success': success, 'error': error}"
  >
    {{ notification }}
  </div>
</template>

<script setup>
import { computed } from 'vue'
import { useUiStore } from '@/stores/ui'

const uiStore = useUiStore()

const notification = computed(() => uiStore.notification)
const isError = computed(() => notification.value?.startsWith('错误'))
const isSuccess = computed(() => notification.value && !isError.value)
</script>

<style scoped>
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 20px;
  border-radius: 4px;
  color: white;
  z-index: 100;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: opacity 0.3s ease;
}

.success {
  background-color: #4CAF50;
}

.error {
  background-color: #F44336;
}
</style>